package COM.AAA.BBB.cc.provider.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import COM.AAA.BBB.cc.dao.ProjectsrcDao;
import COM.AAA.BBB.cc.entity.Projectsrc;
import COM.AAA.BBB.cc.service.intf.ProjectsrcService;
import COM.AAA.BBB.cc.common.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * @ClassName asdfg项目的业务实现层的ProjectsrcServiceImpl类
 * @Description 实现Projectsrc的业务逻辑实现-核心
 * @Author 旭友
 * @Date 2021-11-11 00:17:38
 * @Version 1.0
 */
@Service
public class ProjectsrcServiceImpl extends ProjectsrcService {
    @Autowired
    private ProjectsrcDao dao;


    @Override
    public R save(Projectsrc entity) {
        if (entity!=null){
            if (dao.insert(entity)>0){
                return R.ok();
            }
        }
        return R.fail("新增失败");
    }

    @Override
    public R queryBiId(int id) {
        if(id>0){
            return R.ok(dao.selectById(id));
        }
        return R.fail("请传递参数！");
    }

    @Override
    public R queryPage(int page, int size) {
        Page<Projectsrc> projectPage = new Page<>(page,size);
        return R.ok(dao.selectPage(projectPage,new QueryWrapper<Projectsrc>().orderByAsc("id")));
    }
}
